public class ZS {
    public static void main(String[] args) {
        int js=1;
        for (int i = 2; i <=20000 ; i++) {
            for (int j = 2; j <=i ; j++) {
                if (j == i) {
                    System.out.print(i+" ");
                    js=js+1;
                    if (js == 6) {
                        System.out.print("\n");
                        js=1;
                    }
                    break;
                }
                if (i%j == 0) {
                    break;
                }
            }
        }
    }
}
